//
// Created by HP on 2022/1/22.
//

#ifndef VULKAN_TUTORIAL_LVE_CAMERA_H
#define VULKAN_TUTORIAL_LVE_CAMERA_H

// libs
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
#include <glm/glm.hpp>

namespace lve {

    class LveCamera {
    public:

        void setOrthographicProjection(
            float left, float right,
            float top,  float bottom,
            float near, float far
        );
        void setPerspectiveProjection(float fovy, float aspect, float near, float far);

        /// position: 相机位置
        // 将相机视线调整至 direction
        // up: 用于表示哪一个方向是 up 方向, 默认值是 y 的负方向
        void setViewDirection(
                glm::vec3 position, glm::vec3 direction, glm::vec3 up = glm::vec3{0.f, -1.f, 0.f});
        // 将一个点(target)锁定在相机视图中央
        void setViewTarget(
                glm::vec3 position, glm::vec3 target, glm::vec3 up = glm::vec3{0.f, -1.f, 0.f});
        // 用于旋转相机
        void setViewYXZ(glm::vec3 position, glm::vec3 rotation);
        [[nodiscard]] const glm::mat4& getProjection() const { return projectionMatrix; }
        [[nodiscard]] const glm::mat4& getView() const { return viewMatrix; }
    private:
        glm::mat4 projectionMatrix{1.f};
        glm::mat4 viewMatrix{1.f}; // camera transform
    };

}

#endif //VULKAN_TUTORIAL_LVE_CAMERA_H
